<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/28
  Time: 16:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <%
        request.setCharacterEncoding("utf-8");
        String content = request.getParameter("content");
        out.flush();
        if (content!=null){
            Object obj = session.getAttribute("NAME");
            String str = obj+":"+content;
            List<String> list ;
            Object listObj = application.getAttribute("LIST");
            if (listObj==null){
                list = new ArrayList<>();
            }else {
                list = (List<String>) listObj;
            }
            list.add(str);
            application.setAttribute("LIST",list);
            for ( String s:list){
                out.print(s+"<br/>");
            }
        }
    %>
    <hr/>
    <form action="e3.jsp" method="post">
        <input type="text" name="content"/>
        <button>发送</button>
    </form>
</body>
</html>
